// Reflect 方法用法

const obj = {
    name: 'congyang',
    age: 18
}

console.log(Reflect.has(obj, 'name')) // 是否有某个属性
console.log(Reflect.ownKeys(obj)) // 属性名集合



// 构造函数

class Person {
    constructor (name){
        this.name = name
    }
    static (name){ // 静态方法
        return new Person(name)
    }
    say() {
        console.log(`hi, i am ${this.name}`)
    }
}
const chengzhi = new Person('chengzhi')
chengzhi.say()



// class extends 继承

class Student extends Person {
    constructor (name, age, num) {
        super(name) // 继承父类
        this.num = num 
        this.age = age
    }
    sayHello () {
        super.say()
        console.log(`my age is ${this.age}, my num is ${this.num}`)
    }
}
const student = new Student('congyang', 18, 100) // 创建示例对象
student.sayHello() // 